<?php 
include './c/config.php';
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}

$query=$mysqli->query("SELECT id FROM `uinfo` WHERE `f1` IS NULL ORDER BY `id` LIMIT 0,1");
if($query->num_rows>0){
    
}else{
    exit;
}

$getD=$query->fetch_assoc();
$id=$getD['id'];
$UserFen=0;

//填空
$tkong=json_decode(file_get_contents('./template/mi/tkong.txt'), true);

$tiData=array();
foreach ($tkong as $k=>$v){
    $tiData[($k+1)]=$v['a'];
}
  
$query=$mysqli->query("SELECT * from `tiankong` where uid='".$id."' order by id desc  limit 0,1 ");
if($query->num_rows>0){
    $getUTk=$query->fetch_assoc();
    $yhtj=json_decode($getUTk['yhtj'], true);
    $fen=0;
    foreach ($yhtj as $key => $value){
        foreach ($value as $k => $v ){
           // echo $k, '.....', $v, '.....'; //$tiData[$k]
            if(trim($v) == trim($tiData[$k])){
                $fen++;
                echo '.....对了';
            }
           // echo "<br />";
        }
    }
    echo "<br />";
    echo $fen,'分';
}
if ($fen > 0){
    $UserFen=$fen;
}
echo "<br /><br />";
echo $id,' :填空题分:';
echo $UserFen;
$mysqli->query(" update  `uinfo` set f1='".$UserFen."'  WHERE id='".$id."' ");


 
echo "<br /><br />";







$mysqli->close();
echo '
<script>
window.setTimeout(function(){
window.location.reload();
}, 10);
</script>
    
';
 